﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>DR钻戒后台管理系统</title>
    <link rel="stylesheet" href="css/public.css"/>
    <link rel="stylesheet" href="css/style.css"/>
    <script src="../js/jquery-1.12.4.js"></script>
</head>
<script type="text/javascript">
    function AddGoods() {
        let goodspath1=$("#goodspathId1").val();
        let goodspath2=$("#goodspathId2").val();
        let series=$("#seriesId").val();
        let style=$("#styleId").val();
        let texture=$("#textureId").val();
        let modeid=$("#modeidId").val();
        let shape=$("#shapeId").val();
        let object=$("#objectId").val();
        let type=$("#typeId").val();
        let colour=$("#colourId").val();
        let carat=$("#caratId").val();
        let diamondprice=$("#diamondpriceId").val();
        let diamondnum=$("#diamondnumId").val();
        let caratweight=$("#caratweightId").val();
        let stock=$("#stockId").val();

        var seSeries = document.getElementById("seriesId")
        var seStyle = document.getElementById("styleId")
        var seTexture = document.getElementById("textureId")
        var seModeidId = document.getElementById("modeidId")
        var seShape = document.getElementById("shapeId")
        var seObject = document.getElementById("objectId")
        var seType = document.getElementById("typeId")
        var seColour = document.getElementById("colourId")

        if (seSeries.value==0) {
            alert("请选择系列!")
            return false;
        }
        if (seStyle.value==0) {
            alert("请选择款式!")
            return false;
        }
        if (seTexture.value==0) {
            alert("请选择材质!")
            return false;
        }
        if (seModeidId.value==0) {
            alert("请选择购买方式!")
            return false;
        }
        if (seShape.value==0) {
            alert("请选择形状!")
            return false;
        }
        if (seObject.value==0) {
            alert("请选择送礼对象!")
            return false;
        }
        if (seType.value==0) {
            alert("请选择类型!")
            return false;
        }
        if (seColour.value==0) {
            alert("请选择色彩度!")
            return false;
        }
        if ($('#caratId').val() == ''||$('#caratId').val() == null) {
            alert("请填写克拉!")
            return false;
        }
        if ($('#diamondpriceId').val() == ''||$('#diamondpriceId').val() == null) {
            alert("请填写钻戒价格!")
            return false;
        }

        if ($('#diamondnumId').val() == ''||$('#diamondnumId').val() == null) {
            alert("请填写钻石数量!")
            return false;
        }

        if ($('#caratweightId').val() == ''||$('#caratweightId').val() == null) {
            alert("请填写单钻重量!")
            return false;
        }

        if ($('#stockId').val() == ''||$('#stockId').val() == null) {
            alert("请填写钻戒库存!")
            return false;
        }

        $.post("http://localhost:8080/DiamondRing/BackInsertGoodsServlet","&goodspath1="+goodspath1+"&goodspath2="+goodspath2+"&series="+series+"&style="+style+"&texture="+texture+"&modeid="+modeid+"&shape="+shape+"&object="+object+"&type="+type+"&colour="+colour+"&carat="+carat+"&diamondprice="+diamondprice+"&diamondnum="+diamondnum+"&caratweight="+caratweight+"&stock="+stock,function (data) {
            if (data>0){
                alert("新增钻戒成功!");
                location.href="http://localhost:8080/DiamondRing/back-stage-Management/providerList.html";
            }else{
                alert("新增失败!");
            }
        })
    }

</script>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>DR钻戒后台管理系统</h1>

    <div class="publicHeaderR">
        <a href="login.html">退出</a>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器!</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
        <nav>
            <ul class="list">
                <li><a href="billList.html">订单管理</a></li>
                <li id="active"><a href="providerList.html">商品管理</a></li>
                <li><a href="userList.html">用户管理</a></li>
                <li><a href="password.html">密码修改</a></li>
                <li><a href="login.html">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>供应商管理页面 >> 供应商添加页面</span>
        </div>
        <div class="providerAdd">
            <form action="#">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label><strong>图片 1：</strong></label>
                    <input type="file" id="goodspathId1" name="test">
                    <span >*请选择第一张图片</span>
                </div>
                <div>
                    <label><strong>图片 2：</strong></label>
                    <input type="file" id="goodspathId2" name="test">
                    <span >*请选择第二张图片</span>
                </div>
                <div>
                    <label><strong>钻戒系列：</strong></label>
                    <select name="series" id="seriesId">
                       <option value="0" selected>请选择钻戒系列</option>
                       <option value="1">稀世粉钻系列</option>
                       <option value="2">Forever系列</option>
                       <option value="3">My Heart系列</option>
                       <option value="4">True Love系列</option>
                       <option value="5">I Swear系列</option>
                       <option value="6">Just you系列</option>
                   </select>
                    <span>*请选择钻戒系列</span>
                </div>
                <div>
                   <label ><strong>钻戒款式：</strong></label>
                   <select name="style" id="styleId">
                       <option value="0" selected>请选择钻戒款式</option>
                       <option value="1">经典款</option>
                       <option value="2">简奢款</option>
                       <option value="3">心相恋</option>
                       <option value="4">心相随</option>
                       <option value="5">情缘一生</option>
                       <option value="6">情缘心动</option>
                       <option value="7">典雅款</option>
                       <option value="8">相许</option>
                       <option value="9">简华款</option>
                       <option value="10">挚爱款</option>
                       <option value="11">一生相伴</option>
                       <option value="12">永恒之心</option>
                   </select>
                    <span>*请选择钻戒款式</span>
                </div>
                <div>
                    <label ><strong>钻戒材质：</strong></label>
                    <select name="texture" id="textureId">
                        <option value="0" selected>请选择钻戒材质</option>
                        <option value="1">18k白金</option>
                        <option value="2">18k黄金</option>
                        <option value="3">PT950</option>
                        <option value="4">18k玫瑰金</option>
                    </select>
                    <span>*请选择钻戒材质</span>
                </div>
                <div>
                    <label><strong>购买方式：</strong></label>
                    <select name="texture" id="modeidId">
                        <option value="0" selected>请选择购买方式</option>
                        <option value="1">三成一生</option>
                        <option value="2">新品</option>
                        <option value="3">热门</option>
                        <option value="4">明星同款</option>
                        <option value="5">男款</option>
                    </select>
                    <span>*请选择购买方式</span>
                </div>
                <div>
                    <label><strong>钻石形状：</strong></label>
                    <select name="shape" id="shapeId">
                        <option value="0" selected>请选择钻石形状</option>
                        <option value="1">圆形</option>
                        <option value="2">心形</option>
                        <option value="3">方形</option>
                        <option value="4">心形(双心)</option>
                    </select>
                    <span>*请选择钻石形状</span>
                </div>
                <div>
                    <label><strong>送礼对象：</strong></label>
                    <select name="object" id="objectId">
                        <option value="0" selected>请选择送礼对象</option>
                        <option value="1">浪漫女士</option>
                        <option value="2">尊贵男士</option>
                    </select>
                    <span>*请选择送礼对象</span>
                </div>

                <div>
                    <label ><strong>钻戒类型：</strong></label>
                    <select name="type" id="typeId">
                        <option value="0" selected>请选择钻戒类型</option>
                        <option value="1">对戒</option>
                        <option value="2">吊坠</option>
                        <option value="3">方形</option>
                        <option value="4">项链</option>
                        <option value="5">手链</option>
                        <option value="6">单戒</option>
                    </select>
                    <span>*请选择钻戒类型</span>
                </div>
                <div>
                    <label ><strong>钻戒色彩度：</strong></label>
                    <select name="colour" id="colourId">
                        <option value="0" selected>请选择钻戒色彩度</option>
                        <option value="1">D色</option>
                        <option value="2">E色</option>
                        <option value="3">F色</option>
                        <option value="4">G-H色</option>
                        <option value="6">I-J色</option>
                        <option value="6">K-M色</option>
                        <option value="7">N-Z色</option>
                    </select>
                    <span>*请选择钻戒色彩度</span>
                </div>

                <div id="place">
                    <div>
                        <label ><strong>钻戒克拉：</strong></label>
                        <input type="text" id="caratId" placeholder="请填写钻戒克拉">
                        <span >*请填写钻戒克拉</span>
                    </div>
                    <div>
                        <label ><strong>钻戒价格：</strong></label>
                        <input type="text" id="diamondpriceId" placeholder="请填写钻戒价格">
                        <span >*请填写钻戒价格</span>
                    </div>
                    <div>
                        <label ><strong>钻石数量：</strong></label>
                        <input type="text" id="diamondnumId" placeholder="请填写钻石数量">
                        <span >*请填写钻石数量</span>
                    </div>
                    <div>
                        <label ><strong>单钻重量：</strong></label>
                        <input type="text" id="caratweightId" placeholder="请填写单钻重量">
                        <span >*请填写单钻重量  *单位为克拉</span>
                    </div>
                    <div>
                        <label ><strong>钻戒库存：</strong></label>
                        <input type="text" id="stockId" placeholder="请填写钻戒库存">
                        <span >*请填写钻戒库存</span>
                    </div>
                </div>

                <div class="providerAddBtn">
                    <a href="javascript:void(0)" onclick="AddGoods()">保存</a>
                    <a href="providerList.html">返回</a>
                </div>
            </form>
        </div>

    </div>
</section>
<footer class="footer">
</footer>
<script src="js/time.js"></script>

</body>
</html>